
#ifndef ___GENE_INTERFACE___Base
#define ___GENE_INTERFACE___Base

#include "GeneIf.h"


//
//	Gene On Entity
//
class TCOM_API  GeneImp : public IGene
{
public:
	enum DataIndex
	{
		Idx_MutexRule	=	-2,
		Idx_Duration	=	-1,
	};

	//
	//	Constructor
	//
	GeneImp();

	virtual int		getID()const;
	virtual int		getMutexRule()const;	
	virtual int		getMutexGroup()const;
	virtual int		getDuration()const;	
	virtual IData*	getStaticData();

	//
	//	invoked just after gene's construction
	//	which is used to do all the initialization
	//
	virtual bool onInit(IGeneCreateData& createData);

	//
	//	invoked just after gene is attached on a host object
	//
	virtual bool onAttach();
	//
	//	invoked when gene is detached from its host object
	//
	virtual bool onDetach();
	//
	//	update with the host object
	//
	virtual bool onUpdate(const int& nElapse);
	//
	//	response on a gene event, this is the only way gene communicate with outside logic
	//	Note that gene can received a event only after he register it.
	//
	virtual void onEvent(IEvt& evt);
protected:
	int		m_nID;
	int		m_nMutexRule;
	int		m_nMutexGroup;
	int		m_nTTL;		//	Current remain time to live
						//	Init from duration
	
	IData*		m_wpSData;
};

#endif